﻿using BlazorApp3.Client.Application.Services;

namespace BlazorApp3.Client.Application.Features.Counter.Commands.Reset;

internal class ResetCounterCommandHandler : IRequestHandler<ResetCounterCommand>
{
    private readonly ICounterRepository _counterRepository;

    public ResetCounterCommandHandler(ICounterRepository counterRepository)
    {
        _counterRepository = counterRepository;
    }

    public async Task Handle(ResetCounterCommand request, CancellationToken cancellationToken)
    {
        await _counterRepository.SaveCounter(0);
    }
}